package 小易的升级之路;

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNextInt()) {
            int n = in.nextInt();
            int a = in.nextInt();
            for (int i = 0; i < n; i++) {
                int b = in.nextInt();
                if (a >= b) {
                    a += b;
                } else {
                    a += gcd(a, b);
                }
            }
            System.out.println(a);
        }
    }

    private static int gcd(int a, int b) {
        return b == 0 ? a : gcd(b, a % b);
    }
}
